//
//  CLChocieAnswerButton.m
//  qiyuerciyuan
//
//  Created by culiu-macBook Air on 2018/3/7.
//  Copyright © 2018年 culiu-macBook Air. All rights reserved.
//

#import "CLChocieAnswerButton.h"
@interface CLChocieAnswerButton ()
@property (nonatomic,strong) UILabel *textLabel;
@property (nonatomic,strong) UIImageView *heartImage;

@end
@implementation CLChocieAnswerButton
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithWhite:1 alpha:0.7];
        self.layer.cornerRadius = 5.0f;
        _textLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, kScreenWidth - 20 - 50, 65 )];
        _textLabel.font = CLRudeCircleTextFont(16);
        _textLabel.numberOfLines = 2;
        _textLabel.textAlignment = NSTextAlignmentCenter;
        _textLabel.textColor = KBlackColor;
        [self addSubview:_textLabel];
    }
    return self;
}
- (void)setTextToButton:(NSString *)text {
    _textLabel.text = text;
    
//    _textLabel.width = self.width - 20;
    _textLabel.textAlignment = NSTextAlignmentCenter;
//    [_textLabel sizeToFit];
//    _textLabel.left = 10;
//    _textLabel.top = 10;
    
}
- (void)setCenterText:(NSString *)text {
    _textLabel.text = text;
    _textLabel.width = self.width - 20;
    _textLabel.textAlignment = NSTextAlignmentCenter;
    [_textLabel sizeToFit];
    _textLabel.center = CGPointMake(self.width/2, self.height/2);

}
@end
